﻿using IterationLife.Domains.Sports.Models;
using Util.Datas.Ef;

namespace IterationLife.Datas.Mappings.Sports
{
    /// <summary>
    /// SportUsers映射配置
    /// </summary>
    public class SportUserMap : AggregateRootMapBase<SportUser>
    {
        /// <summary>
        /// 映射表
        /// </summary>
        protected override void MapTable()
        {
            ToTable("SportUsers", "Sports");
        }

        /// <summary>
        /// 映射属性
        /// </summary>
        protected override void MapProperties()
        {
            //体育用户编号
            Property(t => t.Id)
                .HasColumnName("SportUserId");
        }

        /// <summary>
        /// 映射导航属性
        /// </summary>
        protected override void MapAssociations()
        {
            HasRequired(t => t.SportAthlete)
                .WithRequiredPrincipal();
        }
    }
}
